import { Http } from "@/utils/request";
import { Toast } from "@/utils/toast";
import { delayTask } from "@/utils/timer";

const baseUrl = "/common";

export const like_api = (
  data: { id: string | number; type: number },
  showError = true
) => {
  return Http.post(`/v3${baseUrl}/like`, data).catch((error: Error) => {
    showError && delayTask(60, () => Toast.show(error.message));
    return Promise.reject(error);
  });
};
